#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

int N, M;
int way[110][110], deg[110];

int main()
{
    while(~scanf("%d%d", &N, &M) && !(N==0 && M==0)) {
        int x, y, c;
        memset(deg, 0, sizeof(deg));
        memset(way, 0, sizeof(way));
        for(int i = 0; i < M; i++){
            scanf("%d%d%d", &x, &y, &c);
            way[x][y] += c, way[y][x] += c;
            deg[x]++, deg[y]++;
        }
        if(
    }
    return 0;
}

